<template>
  <div class="app-container">
    <div class="head-container">
      <div>
        <!-- 搜索 -->
        <el-input
          v-model="query.userId"
          clearable
          size="small"
          placeholder="请输入用户ID"
          style="width: 200px;"
          class="filter-item"
        />
        <el-input
          v-model="query.phone"
          clearable
          size="small"
          placeholder="请输入手机号"
          style="width: 200px;"
          class="filter-item"
        />
        <date-range-picker v-model="query.transactionTime" class="date-item" />
        <el-select
          v-model="query.transactionStatus"
          clearable
          size="small"
          placeholder="状态"
          class="filter-item"
        >
          <el-option
            v-for="item in enabledTypeOptions"
            :key="item.key"
            :label="item.display_name"
            :value="item.key"
          />
        </el-select>
        <rrOperation />
      </div>
      <div class="btnContain">
        <el-button @click="crud.doExport">下载数据</el-button>
        <!-- <el-button>上传更新收益</el-button> -->
      </div>
    </div>
    <!--表格渲染-->
    <el-table ref="table" v-loading="crud.loading" :height="height" border :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
      <!-- <el-table-column type="selection" width="50" /> -->
      <el-table-column :show-overflow-tooltip="true" prop="transactionTime" label="结算日期" />
      <el-table-column :show-overflow-tooltip="true" prop="projectId" label="项目" />
      <el-table-column :show-overflow-tooltip="true" prop="keywords" label="关键词" />
      <el-table-column :show-overflow-tooltip="true" prop="userId" label="用户ID">
        <template slot-scope="scope">
          {{ scope.row.user?scope.row.user.id: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="phone" label="手机号">
        <template slot-scope="scope">
          {{ scope.row.user?scope.row.user.phone: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="username" label="用户名">
        <template slot-scope="scope">
          {{ scope.row.user?scope.row.user.username: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" label="邀请人">
        <template slot-scope="scope">
          {{ scope.row.userInvitation? scope.row.userInvitation.invitationCode: '--' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="confirmedSettlementAmount" label="结算金额" />
      <el-table-column :show-overflow-tooltip="true" label="状态" align="center" prop="transactionStatus" />
      <!-- <el-table-column :show-overflow-tooltip="true" prop="endDate" label="操作时间" /> -->
      <el-table-column
        label="操作"
        width="300"
        align="center"
      >
        <template slot-scope="scope">
          <el-button type="text" size="small">确认</el-button>
          <el-button type="text" size="small">撤回</el-button>
          <el-button type="text" size="small">恢复</el-button>
          <el-button type="text" size="small">废弃</el-button>
        </template>
      </el-table-column>
      <el-table-column
        label="操作记录"
        width="150"
        align="center"
      >
        <template slot-scope="scope">
          <el-popover
            placement="left"
            width="400"
            trigger="click"
          >
            <el-table border :data="gridData" height="400">
              <el-table-column property="username" :show-overflow-tooltip="true" label="操作人" />
              <el-table-column property="phone" :show-overflow-tooltip="true" label="手机号" />
              <el-table-column property="actionName" :show-overflow-tooltip="true" label="操作" />
              <el-table-column property="actionTime" :show-overflow-tooltip="true" label="操作时间" />
            </el-table>
            <el-button slot="reference" type="text" size="small">查看</el-button>
          </el-popover>
        </template>
      </el-table-column>
    </el-table>
    <!--分页组件-->
    <pagination />
    <!-- </el-col> -->
    <!-- </el-row> -->
  </div>
</template>

<script>
import crudConfirm from '@/api/confirm'
import CRUD, { presenter, header, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker'
import { mapGetters } from 'vuex'
export default {
  name: 'MoneyRemain',
  components: { rrOperation, pagination, DateRangePicker },
  cruds() {
    return CRUD({ title: '收益确认', url: 'api/transactionConfirm', crudMethod: { ...crudConfirm }})
  },
  mixins: [presenter(), header(), crud()],
  data() {
    return {
      enabledTypeOptions: [],
      gridData: [
        { username: 1,
          phone: 110,
          actionName: '222',
          actionTime: '2024'
        }
      ],
      height: document.documentElement.clientHeight - 180 + 'px;'
    }
  },
  computed: {
    ...mapGetters([
      'user'
    ])
  },
  created() {
  },
  mounted: function() {
    const that = this
    window.onresize = function temp() {
      that.height = document.documentElement.clientHeight - 180 + 'px;'
    }
  },
  methods: {
  }
}
</script>

          <style rel="stylesheet/scss" lang="scss" scoped>

            .head-container {
              display: flex;
              justify-content: space-between;
              .btnContain {
                ::v-deep .el-button {
                background-color: rgba(236, 91, 91, 1);
                color: #fff;
                border: 0;
              }
              }
            }

          </style>

